Skip to content

users connectors module for UOU connectors feature#130

Merged
cowchimp merged 13 commits intomainfrom
expose-axios
Mar 16, 2026
Merged

users connectors module for UOU connectors feature#130
cowchimp merged 13 commits intomainfrom
expose-axios

Conversation

@cowchimp
Copy link
Collaborator

No description provided.

@claude
Copy link

claude bot commented Feb 19, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

Summary

This PR exposes the underlying Axios client instances used by the SDK, making them accessible as axiosClient on both the main client and the service role client. This is a small but significant change that allows SDK users to make custom API calls using the same authentication and configuration as the SDK.

Code Quality ✅

The implementation is clean and follows the existing patterns in the codebase:

  • Properly typed in client.types.ts with descriptive JSDoc comments
  • Consistent placement in both user and service role module objects
  • No code duplication or unnecessary complexity

Potential Issues & Concerns 🤔

  1. Security Considerations ⚠️

    • Exposing the raw Axios client gives users direct access to make any API call with the SDK's authentication
    • Users could potentially misuse this to access undocumented endpoints or bypass SDK validation
    • The service role axios client is particularly sensitive as it has elevated permissions
    • Consider documenting security best practices for using the exposed client
  2. API Stability 📋

    • This creates a new public API surface that you'll need to maintain
    • Changes to internal axios configuration could now be breaking changes for users
    • The axios client configuration (interceptors, headers, etc.) becomes part of your public API contract
  3. Missing Documentation 📚

    • While the TypeScript comments are good, consider adding:
      • Examples of proper usage in the main documentation
      • Warnings about what NOT to do with the raw client
      • Guidance on when to use the raw client vs SDK methods

Performance Considerations ✅

No performance concerns - this simply exposes existing objects without creating new ones or adding overhead.

Breaking Changes ✅

This is a non-breaking change that only adds new properties. Existing code will continue to work.

Test Coverage ❌

Missing Tests: The PR doesn't include tests for the newly exposed functionality. Consider adding:

  • Unit tests in tests/unit/client.test.js to verify axiosClient is defined and properly configured
  • Tests to ensure the exposed client has the correct headers and authentication
  • Tests for both user and service role clients

Example test to add:

test('should expose axios client with proper configuration', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
});

Recommendations 💡

  1. Add comprehensive tests for the exposed axios clients
  2. Document security implications and best practices in the README or docs
  3. Consider adding a warning in the JSDoc about not modifying the client configuration
  4. Add examples showing appropriate use cases for the raw client
  5. Consider versioning strategy - mark this as experimental initially if you're unsure about the API

Overall Assessment

This is a useful feature that provides flexibility for advanced users. The implementation is solid, but it needs tests and better documentation around security implications before merging. The change itself is minimal and well-integrated into the existing codebase structure.

@cowchimp cowchimp changed the title expose underlying axios client expose underlying axios client (DON'T MERGE) Feb 19, 2026
@github-actions
Copy link

github-actions bot commented Feb 19, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.20-pr.130.9ca04bf

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.20-pr.130.9ca04bf"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.20-pr.130.9ca04bf"
  }
}

Preview published to npm registry — try new features instantly!

@claude
Copy link

claude bot commented Feb 23, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of the PR that exposes the underlying Axios client instances and adds an initiate method to the connectors module. Here's my comprehensive feedback:

Code Quality and Best Practices ✅

The implementation follows good practices:

  • Clean and minimal changes that follow existing patterns
  • Proper TypeScript typing with descriptive JSDoc comments
  • Consistent placement of axiosClient in both user and service role module objects
  • No code duplication or unnecessary complexity
  • The initiate method follows the same pattern as getAccessToken

Potential Bugs or Issues 🐛

  1. Type Mismatch with @ts-expect-error ⚠️
    Both methods in connectors.ts have @ts-expect-error comments:

    // @ts-expect-error Return type mismatch with interface - implementation returns object, interface expects string
    return response.access_token;

    The issue is that axios.get() returns a response object, but you're accessing response.access_token directly. You should access response.data.access_token:

    const response = await axios.get<ConnectorAccessTokenResponse>(
      `/apps/${appId}/external-auth/tokens/${integrationType}`
    );
    return response.data.access_token;
  2. Inconsistent Error Handling
    The connectors module methods validate input but don't handle API errors. Consider wrapping in try-catch or letting the axios interceptor handle errors consistently.

Performance Considerations ✅

No performance concerns - this simply exposes existing objects without creating new ones or adding overhead.

Security Concerns ⚠️

  1. Direct API Access Risk

    • Exposing the raw Axios client allows users to make any API call with the SDK's authentication
    • Users could potentially access undocumented endpoints or bypass SDK validation
    • The service role axios client is particularly sensitive as it has elevated permissions
  2. Lack of Usage Guidelines

    • No documentation about security best practices when using the exposed client
    • Should warn users about not modifying axios configuration or interceptors
    • Should document that this is an advanced feature requiring careful use
  3. API Contract Exposure

    • Internal axios configuration (headers, interceptors) becomes part of the public API
    • Changes to internal configuration could break user code relying on specific axios behavior

Test Coverage ❌

Critical Issue: No tests were added for the newly exposed functionality. The existing client.test.js doesn't verify:

  • That axiosClient is properly exposed on both user and service role modules
  • That the exposed clients have the correct authentication headers
  • That the connectors initiate method works correctly

Recommended tests to add:

// In client.test.js
test('should expose axios client on user modules', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
});

test('should expose axios client on service role modules', () => {
  const client = createClient({
    appId: 'test-app-id',
    serviceToken: 'service-token'
  });
  
  expect(client.asServiceRole.axiosClient).toBeDefined();
  expect(client.asServiceRole.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer service-token');
});

Additional Recommendations 💡

  1. Fix the TypeScript errors by accessing response.data instead of response directly
  2. Add comprehensive tests for both exposed axios clients and the new initiate method
  3. Add security documentation warning users about responsible use of raw axios access
  4. Consider adding examples in the docs showing appropriate use cases
  5. Document that users shouldn't modify the axios instance configuration
  6. Consider marking as experimental initially with a warning in JSDoc

Overall Assessment

This is a useful feature that provides flexibility for advanced users. The implementation is clean but needs:

  1. Bug fixes for the TypeScript errors
  2. Comprehensive test coverage
  3. Security documentation and usage guidelines

The lack of tests is the most critical issue that should be addressed before merging.

@claude
Copy link

claude bot commented Feb 23, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

Summary

This PR exposes the underlying Axios client instances as axiosClient on both the user client and service role client. Additionally, it adds a new connectors module that provides methods for OAuth token retrieval and initiation. This is a valuable feature that gives advanced users more flexibility to make custom API calls.

Code Quality Issues 🔴

  1. Critical TypeScript Errors in connectors.ts

    • Lines 23-24: @ts-expect-error comment indicates a return type mismatch between the interface and implementation
    • Line 36: Returning response.access_token when the axios response is typed as ConnectorAccessTokenResponse
    • Line 52: Similar issue returning response.redirect_url

    The implementation is accessing properties directly on the axios response object instead of response.data:

    // Current (incorrect):
    return response.access_token;
    
    // Should be:
    return response.data.access_token;
  2. Inconsistent Error Handling

    • The connectors module validates input parameters but doesn't handle API errors consistently with other modules
    • No error wrapping or custom error types like other modules might use

Potential Bugs 🐛

  1. Axios Response Data Access Bug

    • The getAccessToken and initiate methods are trying to access properties directly on the axios response object instead of response.data
    • This will cause runtime errors as axios returns data in response.data, not on the response object itself
  2. Type Safety Compromised

    • Using @ts-expect-error masks real implementation bugs that would cause runtime failures
    • The interface promises to return a string but the implementation tries to return an object

Performance Considerations ✅

No performance concerns. The implementation simply exposes existing axios instances without creating new ones or adding overhead.

Security Implications ⚠️

  1. Exposed Authentication Headers

    • Users can inspect and potentially misuse authentication headers
    • Service role axios client access is particularly sensitive as it has admin privileges
    • Users could make API calls to undocumented endpoints
  2. Missing Security Documentation

    • No warnings about the security implications of using raw axios clients
    • No guidance on what users should NOT do with these clients
  3. OAuth Token Exposure

    • The connectors module exposes raw OAuth tokens for external services
    • No documentation about secure token handling practices

Test Coverage ❌

  1. No Tests for Exposed Axios Clients

    • The client.test.js file doesn't include any tests verifying the axiosClient property exists or is properly configured
    • Missing tests for both user and service role axios clients
  2. No Tests for Connectors Module

    • No test file exists for the new connectors functionality
    • Critical paths like error handling and parameter validation are untested

Additional Concerns 📋

  1. API Contract Stability

    • Exposing the raw axios client makes its configuration part of your public API
    • Future changes to axios config, interceptors, or headers become breaking changes
  2. Missing JSDoc Examples

    • While the TypeScript interfaces have good documentation, the actual usage of axiosClient lacks examples
    • Users might not understand when to use the raw client vs SDK methods

Recommendations 💡

  1. Fix the TypeScript Errors (Critical)

    // In connectors.ts
    const response = await axios.get<ConnectorAccessTokenResponse>(
      `/apps/${appId}/external-auth/tokens/${integrationType}`
    );
    return response.data.access_token;
  2. Add Comprehensive Tests

    // In client.test.js
    test('should expose axios client with proper configuration', () => {
      const client = createClient({
        appId: 'test-app-id',
        token: 'user-token'
      });
      
      expect(client.axiosClient).toBeDefined();
      expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
      expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
    });
  3. Add Security Documentation

    • Document security best practices in the main README
    • Add warnings about not modifying the axios client configuration
    • Provide guidelines for secure OAuth token handling
  4. Consider Making This Experimental

    • Mark the axiosClient property as @experimental or @beta in JSDoc
    • This gives you flexibility to change the API if needed
  5. Add Integration Tests for Connectors

    • Test successful token retrieval
    • Test error cases (invalid integration type, network errors)
    • Test the OAuth initiation flow

Overall Assessment

The feature is useful and the integration into the existing codebase structure is clean. However, the implementation has critical bugs that will cause runtime failures. The TypeScript errors must be fixed before merging, and comprehensive tests should be added to ensure reliability. The security implications also need better documentation.

Todo List:

  • Read changed files to understand the implementation
  • Analyze code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

@github-actions github-actions bot added the docs-draft PR has auto-drafted documentation suggestions label Feb 23, 2026
@claude
Copy link

claude bot commented Feb 26, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of the PR that exposes the underlying Axios client instances and adds the connectors module. Here's my comprehensive feedback:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors have been fixed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have not been fixed:

Lines 36 and 52: The code is trying to access properties directly on the axios response object instead of response.data:

// Current (incorrect):
return response.access_token;  // line 36
return response.redirect_url;  // line 52

// Should be:
return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments, but will cause runtime failures when the methods are called. This is a blocking issue that must be fixed.

2. Test Coverage Missing ❌

No tests have been added for any of the new functionality:

  • No tests for the exposed axiosClient property on both user and service role clients
  • No tests for the connectors module methods (getAccessToken, initiate, disconnect)
  • The existing client.test.js file doesn't verify the new properties exist or are properly configured

Code Quality Analysis ✅

The overall code structure is clean:

  • Follows existing patterns in the codebase
  • Proper TypeScript typing with JSDoc comments
  • Consistent placement of axiosClient in module objects
  • No code duplication

Security Concerns ⚠️

  1. Direct API Access: Exposing the raw Axios client allows users to:

    • Make any API call with the SDK's authentication
    • Potentially access undocumented endpoints
    • Bypass SDK validation and safety checks
  2. Service Role Access: The service role axios client is particularly sensitive as it has elevated permissions

  3. Missing Documentation: No security guidelines or warnings about responsible use

Performance Considerations ✅

No performance issues - the implementation simply exposes existing objects without creating new ones or adding overhead.

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL)

// In connectors.ts, fix both methods:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

async initiate(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.post<ConnectorInitiateResponse>(
    `/apps/${appId}/end-user-auth/initiate`,
    { integration_type: integrationType }
  );

  return response.data.redirect_url; // Fix: access data property
}

2. Add Comprehensive Tests

// Add to client.test.js:
test('should expose axios client with proper configuration', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
});

test('should expose axios client on service role', () => {
  const client = createClient({
    appId: 'test-app-id',
    serviceToken: 'service-token'
  });
  
  expect(client.asServiceRole.axiosClient).toBeDefined();
  expect(client.asServiceRole.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer service-token');
});

// Create new connectors.test.js file with tests for all three methods

3. Add Security Documentation

Consider adding to the JSDoc:

/**
 * The underlying Axios instance used for API requests.
 * 
 * ⚠️ **Security Warning**: This provides direct access to make authenticated API calls.
 * Use with caution and only when SDK methods don't meet your needs.
 * 
 * @security Never modify the axios instance configuration or interceptors
 * @security Be careful not to expose authentication tokens in logs or errors
 */
axiosClient: AxiosInstance;

4. Consider Marking as Experimental

Add @experimental or @beta tags to indicate this API might change:

/**
 * @experimental This API is experimental and may change in future versions
 */

Overall Assessment

The feature is useful and the integration is clean, but the TypeScript errors are a critical blocker. These bugs will cause runtime failures and must be fixed before merging. Additionally, the complete lack of test coverage is concerning for a public API addition.

The implementation needs:

  1. ✅ Bug fixes for the TypeScript errors
  2. ✅ Test coverage for all new functionality
  3. ✅ Security documentation and usage guidelines

Once these issues are addressed, this will be a valuable addition to the SDK.

@cowchimp cowchimp marked this pull request as ready for review February 26, 2026 10:51
@claude
Copy link

claude bot commented Mar 1, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of this PR that exposes the underlying Axios client instances and adds connectors module functionality. Here's my comprehensive feedback:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors have been fixed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have NOT been fixed:

In src/modules/connectors.ts:

  • Line 36: return response.access_token;
  • Line 52: return response.redirect_url;
  • Line 68: return response.access_token;
  • Line 84: return response.redirect_url;

These are trying to access properties directly on the axios response object instead of response.data. The code should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code Not Removed

The author's review comments indicate debug code at:

  • src/client.ts:150 - axiosClient in user modules
  • src/client.ts:184 - axiosClient in service role modules
  • src/client.types.ts:93 - JSDoc for user axiosClient
  • src/client.types.ts:131 - JSDoc for service role axiosClient

These were added "for fast feedback loop" and need to be removed before merging.

3. No Test Coverage ❌

Zero tests have been added for the new functionality:

  • No tests verifying axiosClient is exposed on both user and service role clients
  • No tests for the connectors module methods (getAccessToken, initiate, disconnect)
  • No tests verifying proper authentication headers on the exposed axios instances

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with JSDoc comments
  • No code duplication
  • Consistent naming and organization

Security Implications ⚠️

  1. Direct API Access Risk: Exposing the raw Axios client allows users to:

    • Make any API call with SDK authentication
    • Potentially access undocumented endpoints
    • Bypass SDK validation and safety checks
  2. Service Role Exposure: The service role axios client is particularly sensitive with elevated permissions

  3. Missing Security Documentation: No warnings or guidelines about responsible use

Performance Considerations ✅

No performance concerns - the implementation simply exposes existing objects without creating new ones.

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL)

// In all connector methods, change from:
return response.access_token;
// To:
return response.data.access_token;

2. Remove Debug Code

Remove the axiosClient properties and their JSDoc comments as indicated in the review comments.

3. Add Comprehensive Tests

// Example tests to add:
test('should expose axios client with proper configuration', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
});

// Add tests for connectors module methods

4. Add Security Documentation

Consider adding warnings to the JSDoc:

/**
 * The underlying Axios instance used for API requests.
 * 
 * ⚠️ **Security Warning**: This provides direct access to make authenticated API calls.
 * Use with caution and only when SDK methods don't meet your needs.
 * Never modify the axios instance configuration or interceptors.
 */

Overall Assessment

The feature concept is useful and the integration is clean, but this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed
  2. Debug code that needs removal - As noted by the author
  3. Complete lack of test coverage - New public APIs need tests

The PR title says "(DON'T MERGE)" which is appropriate given these issues. Once the TypeScript errors are fixed, debug code is removed, and tests are added, this will be a valuable addition to the SDK.

@claude
Copy link

claude bot commented Mar 8, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of the PR that exposes the underlying Axios client instances and adds connectors module functionality. Here are my findings:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors have been fixed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-59: Incorrect type casting in getConnection
  • Line 90: return response.access_token; (in getAppUserAccessToken)
  • Line 103: return response.redirect_url; (in connectAppUser)

These should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code Still Present

The author's review comments indicate debug code at:

  • src/client.ts:150 - axiosClient in user modules
  • src/client.ts:184 - axiosClient in service role modules
  • src/client.types.ts:93 - JSDoc for user axiosClient
  • src/client.types.ts:131 - JSDoc for service role axiosClient

These were added "for fast feedback loop" and need to be removed before merging as noted by the author.

3. Incomplete Test Coverage ❌

  • No tests for the exposed axiosClient properties on both user and service role clients
  • No tests for deprecated getAccessToken method
  • No tests for user connectors methods (getAppUserAccessToken, connectAppUser, disconnectAppUser)
  • Only tests for getConnection method exist

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with JSDoc comments
  • No code duplication
  • Consistent naming and organization

However, the use of @ts-expect-error to suppress legitimate type errors is problematic.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes when these methods are called
  2. Type Safety Compromised: Using @ts-expect-error hides real bugs
  3. Incorrect Type Casting: Line 55 in connectors.ts uses unsafe type casting that doesn't fix the underlying issue

Performance Considerations ✅

No performance concerns - the implementation simply exposes existing objects without creating new ones.

Security Implications ⚠️

  1. Direct API Access Risk: Exposing the raw Axios client allows users to:

    • Make any API call with SDK authentication
    • Potentially access undocumented endpoints
    • Bypass SDK validation and safety checks
  2. Service Role Exposure: The service role axios client is particularly sensitive with elevated permissions

  3. Missing Security Documentation: No warnings or guidelines about responsible use

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Remove Debug Code

Remove the axiosClient properties and their JSDoc comments as indicated in the review comments.

3. Add Comprehensive Tests

// Example tests to add:
test('should expose axios client with proper configuration', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
});

4. Add Security Documentation

Consider adding warnings to the JSDoc about the security implications and best practices for using the exposed axios clients.

Overall Assessment

The feature concept is useful and the integration is clean, but this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed
  2. Debug code that needs removal - As noted by the author
  3. Incomplete test coverage - New public APIs need comprehensive tests

The PR title says "(DON'T MERGE)" which is appropriate given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used.

@claude
Copy link

claude bot commented Mar 11, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of this PR that exposes the underlying Axios client instances and adds connectors module functionality. Here are my findings:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors have been fixed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-59: Incorrect type casting in getConnection
  • Line 90: return response.access_token; (in getAppUserAccessToken)
  • Line 103: return response.redirect_url; (in connectAppUser)

These should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code Still Present

The author's review comments indicate debug code that needs removal:

  • src/client.ts:150 - axiosClient in user modules
  • src/client.ts:184 - axiosClient in service role modules
  • src/client.types.ts:93 - JSDoc for user axiosClient
  • src/client.types.ts:131 - JSDoc for service role axiosClient

These were added "for fast feedback loop" and need to be removed before merging as noted by the author.

3. Incomplete Test Coverage ❌

  • No tests for the exposed axiosClient properties on both user and service role clients
  • No tests for deprecated getAccessToken method
  • No tests for user connectors methods (getAppUserAccessToken, connectAppUser, disconnectAppUser)
  • Only tests for getConnection method exist

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with JSDoc comments
  • No code duplication
  • Consistent naming and organization

However, the use of @ts-expect-error to suppress legitimate type errors is problematic.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes when these methods are called
  2. Type Safety Compromised: Using @ts-expect-error hides real bugs
  3. Incorrect Type Casting: Line 55 in connectors.ts uses unsafe type casting that doesn't fix the underlying issue:
    const data = response as unknown as ConnectorAccessTokenResponse;
    This doesn't solve the problem - response is still an AxiosResponse object, not the data.

Performance Considerations ✅

No performance concerns - the implementation simply exposes existing objects without creating new ones.

Security Implications ⚠️

  1. Direct API Access Risk: Exposing the raw Axios client allows users to:

    • Make any API call with SDK authentication
    • Potentially access undocumented endpoints
    • Bypass SDK validation and safety checks
  2. Service Role Exposure: The service role axios client is particularly sensitive with elevated permissions

  3. Missing Security Documentation: No warnings or guidelines about responsible use

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Remove Debug Code

Remove the axiosClient properties and their JSDoc comments as indicated in the review comments.

3. Add Comprehensive Tests

// Example tests to add:
test('should expose axios client with proper configuration', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
});

4. Add Security Documentation

Consider adding warnings to the JSDoc about the security implications and best practices for using the exposed axios clients.

Overall Assessment

The feature concept is useful and the integration is clean, but this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed
  2. Debug code that needs removal - As noted by the author
  3. Incomplete test coverage - New public APIs need comprehensive tests

The PR title says "(DON'T MERGE)" which is appropriate given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used.

@claude
Copy link

claude bot commented Mar 15, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of this PR that exposes the underlying Axios client instances and adds connectors module functionality. Here are my findings:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors in connectors.ts have been fixed
  • Verify if debug code has been removed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-59: Incorrect type casting in getConnection
  • Line 90: return response.access_token; (in getAppUserAccessToken)
  • Line 103: return response.redirect_url; (in connectAppUser)

These should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code Still Present

The author's review comments indicate debug code that needs removal:

  • src/client.ts:150 - axiosClient in user modules
  • src/client.ts:184 - axiosClient in service role modules
  • src/client.types.ts:98 - JSDoc for user axiosClient
  • src/client.types.ts:136 - JSDoc for service role axiosClient

I confirmed these are still present in the code. These were added "for fast feedback loop" and need to be removed before merging as noted by the author.

3. Incomplete Test Coverage ❌

  • No tests for the exposed axiosClient properties on both user and service role clients
  • No tests for deprecated getAccessToken method
  • No tests for user connectors methods (getAppUserAccessToken, connectAppUser, disconnectAppUser)
  • Only tests for getConnection method exist

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with JSDoc comments
  • No code duplication
  • Consistent naming and organization

However, the use of @ts-expect-error to suppress legitimate type errors is problematic.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes when these methods are called
  2. Type Safety Compromised: Using @ts-expect-error hides real bugs
  3. Incorrect Type Casting: Line 55 in connectors.ts uses unsafe type casting that doesn't fix the underlying issue:
    const data = response as unknown as ConnectorAccessTokenResponse;
    This doesn't solve the problem - response is still an AxiosResponse object, not the data.

Performance Considerations ✅

No performance concerns - the implementation simply exposes existing objects without creating new ones.

Security Implications ⚠️

  1. Direct API Access Risk: Exposing the raw Axios client allows users to:

    • Make any API call with SDK authentication
    • Potentially access undocumented endpoints
    • Bypass SDK validation and safety checks
  2. Service Role Exposure: The service role axios client is particularly sensitive with elevated permissions

  3. Missing Security Documentation: No warnings or guidelines about responsible use

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Remove Debug Code

Remove the axiosClient properties and their JSDoc comments as indicated in the review comments.

3. Add Comprehensive Tests

// Example tests to add:
test('should expose axios client with proper configuration', () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  expect(client.axiosClient).toBeDefined();
  expect(client.axiosClient.defaults.headers['X-App-Id']).toBe('test-app-id');
  expect(client.axiosClient.defaults.headers.common['Authorization']).toBe('Bearer user-token');
});

4. Add Security Documentation

Consider adding warnings to the JSDoc about the security implications and best practices for using the exposed axios clients.

Overall Assessment

The feature concept is useful and the integration is clean, but this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed
  2. Debug code that needs removal - As noted by the author
  3. Incomplete test coverage - New public APIs need comprehensive tests

The PR title says "(DON'T MERGE)" which is appropriate given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used.

@claude
Copy link

claude bot commented Mar 16, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of this PR that exposes the underlying Axios client instances and adds connectors module functionality. Here are my findings:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors in connectors.ts have been fixed
  • Verify if debug code has been removed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-59: Incorrect type casting in getConnection
  • Line 90: return response.access_token; (in getAppUserAccessToken)
  • Line 103: return response.redirect_url; (in connectAppUser)

These should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code NOT Present

Contrary to the author's review comments, I did NOT find the debug code (axiosClient exposure) at the specified locations:

  • src/client.ts:150 - No axiosClient property found
  • src/client.ts:184 - No axiosClient property found
  • src/client.types.ts:98 - No JSDoc for user axiosClient
  • src/client.types.ts:136 - No JSDoc for service role axiosClient

The axiosClient is not actually exposed in the current code, which might be intentional given the PR title "(DON'T MERGE)".

3. Incomplete Test Coverage ❌

  • No tests for the exposed axiosClient properties (because they don't exist in the code)
  • No tests for deprecated getAccessToken method
  • No tests for user connectors methods (getAppUserAccessToken, connectAppUser, disconnectAppUser)
  • Only tests for getConnection method exist

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with comprehensive JSDoc comments
  • No code duplication
  • Consistent naming and organization
  • The connectors module documentation is excellent with many examples

However, the use of @ts-expect-error to suppress legitimate type errors is problematic.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes when these methods are called
  2. Type Safety Compromised: Using @ts-expect-error hides real bugs
  3. Incorrect Type Casting: Line 55 in connectors.ts uses unsafe type casting that doesn't fix the underlying issue:
    const data = response as unknown as ConnectorAccessTokenResponse;
    This doesn't solve the problem - response is still an AxiosResponse object, not the data.

Performance Considerations ✅

No performance concerns - the implementation simply adds new module methods without creating additional overhead.

Security Implications ⚠️

While the axiosClient is not actually exposed in this code, the connectors module does have security implications:

  1. OAuth Token Access: The connectors module provides direct access to OAuth tokens for external services
  2. Service Role Access: The service role connectors module has access to app-scoped OAuth tokens which are sensitive
  3. User-Scoped Tokens: The user connectors module manages individual user OAuth tokens

These are expected security considerations for an OAuth token management module, but proper documentation and usage guidelines are important.

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Clarify Intent Regarding axiosClient Exposure

The PR title mentions exposing the axios client, but it's not actually exposed in the current code. If this is intentional, update the PR description to clarify. If not, implement the exposure as originally planned.

3. Add Comprehensive Tests

// Example tests to add for user connectors:
test('should retrieve app user access token', async () => {
  const client = createClient({
    appId: 'test-app-id',
    token: 'user-token'
  });
  
  scope.get('/api/apps/test-app-id/app-user-auth/connectors/connector-123/token')
    .reply(200, { access_token: 'user-oauth-token' });
  
  const token = await client.connectors.getAppUserAccessToken('connector-123');
  expect(token).toBe('user-oauth-token');
});

4. Consider Removing @ts-expect-error Comments

Instead of suppressing TypeScript errors, fix the underlying issues. The current approach will lead to runtime failures.

Overall Assessment

The connectors module is a useful addition with excellent documentation, but this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed
  2. Missing functionality - The PR title mentions exposing axiosClient but it's not actually exposed
  3. Incomplete test coverage - New public APIs need comprehensive tests

The PR title says "(DON'T MERGE)" which is appropriate given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used.

@claude
Copy link

claude bot commented Mar 16, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of this PR that aims to expose the underlying Axios client instances and adds connectors module functionality. Here are my findings:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors in connectors.ts have been fixed
  • Verify if debug code has been removed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in multiple previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-59: Incorrect type casting in getConnection
  • Line 90: return response.access_token; (in getAppUserAccessToken)
  • Line 103: return response.redirect_url; (in connectAppUser)

These should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code Has Been Removed ✅

Good news - the debug code mentioned in the review comments has been successfully removed:

  • No axiosClient properties found on lines 150 and 184 in client.ts
  • No axiosClient JSDoc comments found in client.types.ts

3. Incomplete Test Coverage ❌

  • No tests for the exposed axiosClient properties (if they were to be added back)
  • No tests for deprecated getAccessToken method
  • No tests for user connectors methods (getAppUserAccessToken, connectAppUser, disconnectAppUser)
  • Only tests for getConnection method exist

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with comprehensive JSDoc comments
  • No code duplication
  • Consistent naming and organization

However, the use of @ts-expect-error to suppress legitimate type errors is a serious anti-pattern.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes when these methods are called. Example:

    // Line 41 - This will throw: Cannot read property 'access_token' of undefined
    return response.access_token;
  2. Incorrect Type Casting: Line 55 in connectors.ts uses unsafe type casting that doesn't fix the underlying issue:

    const data = response as unknown as ConnectorAccessTokenResponse;

    This doesn't solve the problem - response is still an AxiosResponse object, not the data.

  3. Type Safety Compromised: Using @ts-expect-error hides real bugs that TypeScript is correctly identifying.

Performance Considerations ✅

No performance concerns - the implementation simply exposes existing objects without creating new ones or adding overhead.

Security Implications ⚠️

  1. Direct API Access Risk: If the axiosClient were to be exposed:

    • Users could make any API call with SDK authentication
    • Could potentially access undocumented endpoints
    • Could bypass SDK validation and safety checks
  2. Service Role Exposure: The service role axios client would be particularly sensitive with elevated permissions

  3. OAuth Token Exposure: The connectors module exposes raw OAuth tokens with no documentation about secure handling

  4. Missing Security Documentation: No warnings or guidelines about responsible use of these features

Test Coverage Assessment ❌

The test coverage is severely lacking:

  • Only getConnection method is tested
  • No tests for error cases in user connectors module
  • No integration tests
  • No tests verifying proper authentication headers

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL - Blocking Issue)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Add Comprehensive Tests

// Example tests to add:
test('deprecated getAccessToken returns token string', async () => {
  const apiResponse = {
    access_token: "token-123",
    integration_type: "slack"
  };
  
  scope
    .get(`/api/apps/${appId}/external-auth/tokens/slack`)
    .reply(200, apiResponse);
    
  const token = await base44.asServiceRole.connectors.getAccessToken('slack');
  expect(token).toBe('token-123');
});

// Add similar tests for user connectors methods

3. Add Security Documentation

Consider adding warnings to the JSDoc about:

  • Security implications of exposing raw OAuth tokens
  • Best practices for secure token handling
  • Guidelines for when to use connectors vs integrations module

4. Consider API Design

The getConnection method implementation seems hacky with its type casting. Consider fixing the axios response handling properly.

Overall Assessment

While the feature concept is useful and the integration follows existing patterns, this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed before merging
  2. Incomplete test coverage - New public APIs need comprehensive tests
  3. Security documentation missing - Users need guidance on secure usage

The PR title appropriately says "(DON'T MERGE)" given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used. These same issues have been identified in at least 6 previous reviews but remain unfixed.

Recommendation: Do not merge until the critical TypeScript errors are fixed and comprehensive tests are added.

@claude
Copy link

claude bot commented Mar 16, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Expose Underlying Axios Client

I've completed my review of this PR that aims to expose the underlying Axios client instances and adds connectors module functionality. Here are my findings:

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors in connectors.ts have been fixed
  • Verify if debug code has been removed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in multiple previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-59: Incorrect type casting in getConnection
  • Line 90: return response.access_token; (in getAppUserAccessToken)
  • Line 103: return response.redirect_url; (in connectAppUser)

These should be:

return response.data.access_token;
return response.data.redirect_url;

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called.

2. Debug Code Has Been Removed ✅

Good news - the debug code mentioned in the review comments has been successfully removed:

  • No axiosClient properties found on lines 150 and 184 in client.ts
  • No axiosClient JSDoc comments found in client.types.ts

3. Incomplete Test Coverage ❌

  • No tests for the exposed axiosClient properties (if they were to be added back)
  • No tests for deprecated getAccessToken method
  • No tests for user connectors methods (getAppUserAccessToken, connectAppUser, disconnectAppUser)
  • Only tests for getConnection method exist

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Proper TypeScript typing with comprehensive JSDoc comments
  • No code duplication
  • Consistent naming and organization

However, the use of @ts-expect-error to suppress legitimate type errors is a serious anti-pattern.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes when these methods are called. Example:

    // Line 41 - This will throw: Cannot read property 'access_token' of undefined
    return response.access_token;
  2. Incorrect Type Casting: Line 55 in connectors.ts uses unsafe type casting that doesn't fix the underlying issue:

    const data = response as unknown as ConnectorAccessTokenResponse;

    This doesn't solve the problem - response is still an AxiosResponse object, not the data.

  3. Type Safety Compromised: Using @ts-expect-error hides real bugs that TypeScript is correctly identifying.

Performance Considerations ✅

No performance concerns - the implementation simply exposes existing objects without creating new ones or adding overhead.

Security Implications ⚠️

  1. Direct API Access Risk: If the axiosClient were to be exposed:

    • Users could make any API call with SDK authentication
    • Could potentially access undocumented endpoints
    • Could bypass SDK validation and safety checks
  2. Service Role Exposure: The service role axios client would be particularly sensitive with elevated permissions

  3. OAuth Token Exposure: The connectors module exposes raw OAuth tokens with no documentation about secure handling

  4. Missing Security Documentation: No warnings or guidelines about responsible use of these features

Test Coverage Assessment ❌

The test coverage is severely lacking:

  • Only getConnection method is tested
  • No tests for error cases in user connectors module
  • No integration tests
  • No tests verifying proper authentication headers

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL - Blocking Issue)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Add Comprehensive Tests

// Example tests to add:
test('deprecated getAccessToken returns token string', async () => {
  const apiResponse = {
    access_token: "token-123",
    integration_type: "slack"
  };
  
  scope
    .get(`/api/apps/${appId}/external-auth/tokens/slack`)
    .reply(200, apiResponse);
    
  const token = await base44.asServiceRole.connectors.getAccessToken('slack');
  expect(token).toBe('token-123');
});

// Add similar tests for user connectors methods

3. Add Security Documentation

Consider adding warnings to the JSDoc about:

  • Security implications of exposing raw OAuth tokens
  • Best practices for secure token handling
  • Guidelines for when to use connectors vs integrations module

4. Consider API Design

The getConnection method implementation seems hacky with its type casting. Consider fixing the axios response handling properly.

Overall Assessment

While the feature concept is useful and the integration follows existing patterns, this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed before merging
  2. Incomplete test coverage - New public APIs need comprehensive tests
  3. Security documentation missing - Users need guidance on secure usage

The PR title appropriately says "(DON'T MERGE)" given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used. These same issues have been identified in at least 6 previous reviews but remain unfixed.

Recommendation: Do not merge until the critical TypeScript errors are fixed and comprehensive tests are added.

@cowchimp cowchimp changed the title expose underlying axios client (DON'T MERGE) users connectors module for UOU connectors feature Mar 16, 2026
@claude
Copy link

claude bot commented Mar 16, 2026

Claude finished @cowchimp's task —— View job


Pull Request Review: Users Connectors Module

I've completed my review of this PR that adds connectors module functionality for the UOU connectors feature.

Todo List:

  • Read all changed files to understand the implementation
  • Check if previous TypeScript errors in connectors.ts have been fixed
  • Verify if debug code has been removed
  • Analyze code quality and best practices
  • Identify potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Review test coverage
  • Provide comprehensive feedback

Critical Issues 🔴

1. TypeScript Errors Still Present in connectors.ts

The critical bugs identified in previous reviews have NOT been fixed. The code is trying to access properties directly on the axios response object instead of response.data:

In src/modules/connectors.ts:

  • Line 41: return response.access_token; (in getAccessToken)
  • Lines 55-58: Incorrect type casting in getConnection:
    const data = response as unknown as ConnectorAccessTokenResponse;
    return {
      accessToken: data.access_token,
      connectionConfig: data.connection_config ?? null,
    };
  • Line 88: return data.access_token; (in getCurrentAppUserAccessToken)
  • Line 101: return data.redirect_url; (in connectAppUser)

These errors are masked by @ts-expect-error comments but will cause runtime failures when the methods are called. The correct approach is:

return response.data.access_token;
return response.data.redirect_url;

2. Debug Code Removed ✅

Good news - the debug code mentioned in review comments appears to have been removed. I did not find any axiosClient properties exposed in client.ts or client.types.ts.

3. Incomplete Test Coverage ❌

  • No tests for the deprecated getAccessToken method
  • No tests for user connectors methods (getCurrentAppUserAccessToken, connectAppUser, disconnectAppUser)
  • No tests for error cases
  • Only tests for getConnection method exist in connectors.test.ts

Code Quality Analysis ✅

The overall structure follows existing patterns well:

  • Clean integration into the existing module system
  • Comprehensive JSDoc documentation with many examples
  • Consistent naming and organization
  • Proper TypeScript typing
  • Function naming follows conventions (though see netanelgilad's comment about "Current" prefix)

However, the use of @ts-expect-error to suppress legitimate type errors is problematic.

Potential Bugs 🐛

  1. Runtime Failures: The axios response access pattern will cause crashes. Example:

    // This will throw: Cannot read property 'access_token' of undefined
    return response.access_token;
  2. Type Safety Compromised: Using @ts-expect-error hides real bugs that TypeScript is correctly identifying

  3. Incorrect Type Casting: The type casting approach doesn't fix the underlying issue - response is still an AxiosResponse object containing the data in response.data

Performance Considerations ✅

No performance concerns - the implementation simply adds new module methods without creating additional overhead.

Security Implications ⚠️

  1. OAuth Token Exposure: The connectors module exposes raw OAuth tokens with limited documentation about secure handling

  2. Missing Security Guidelines: No warnings about:

    • Proper token storage and handling
    • Not exposing tokens in client-side code
    • Rate limiting considerations when using external APIs
  3. Connector ID Exposure: User connectors use database IDs directly, which could be a minor information disclosure

Test Coverage Assessment ❌

The test coverage is severely lacking:

  • Only getConnection method has tests
  • No tests for deprecated getAccessToken
  • No tests for any user connectors methods
  • No error case testing for user methods
  • No integration tests

Recommendations 💡

1. Fix the TypeScript Errors (CRITICAL - Blocking)

// Example fix for getAccessToken:
async getAccessToken(integrationType: ConnectorIntegrationType): Promise<string> {
  if (!integrationType || typeof integrationType !== "string") {
    throw new Error("Integration type is required and must be a string");
  }

  const response = await axios.get<ConnectorAccessTokenResponse>(
    `/apps/${appId}/external-auth/tokens/${integrationType}`
  );

  return response.data.access_token; // Fix: access data property
}

2. Consider the "Current" Naming Suggestion

As netanelgilad suggested, consider renaming to getCurrentAppUserAccessToken for consistency and future flexibility.

3. Add Comprehensive Tests

// Example tests to add:
test('deprecated getAccessToken returns token string', async () => {
  const apiResponse = {
    access_token: "token-123",
    integration_type: "slack"
  };
  
  scope
    .get(`/api/apps/${appId}/external-auth/tokens/slack`)
    .reply(200, apiResponse);
    
  const token = await base44.asServiceRole.connectors.getAccessToken('slack');
  expect(token).toBe('token-123');
});

// Add similar tests for user connectors methods

4. Add Security Documentation

Consider adding security warnings in the JSDoc about:

  • Secure token handling best practices
  • Warnings against exposing tokens in frontend code
  • Rate limiting considerations

Overall Assessment

While the feature concept is useful and the integration follows existing patterns, this PR has critical blocking issues:

  1. TypeScript errors that will cause runtime failures - These MUST be fixed before merging
  2. Incomplete test coverage - New public APIs need comprehensive tests
  3. Missing security documentation - Users need guidance on secure OAuth token usage

The PR title appropriately says "(DON'T MERGE)" given these issues. The TypeScript errors are the most critical blocker as they will cause the SDK to crash when these methods are used. These same issues have been identified in multiple previous reviews but remain unfixed.

Recommendation: Do not merge until the critical TypeScript errors are fixed and comprehensive tests are added.

@cowchimp cowchimp merged commit 5d8ed55 into main Mar 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-draft PR has auto-drafted documentation suggestions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants